#include "renderparent.h"
RenderParent::RenderParent(RenderWidget *render_widget):renderWidget(render_widget)
{
    if(renderWidget)
        renderWidget->setParent(this);
}

void RenderParent::resizeEvent(QResizeEvent *e)
{
    QWidget::resizeEvent(e);
    renderWidget->resize(this->width(),this->height());
    return;
    if(renderWidget)
    {
        float oldRatio = (float)renderWidget->winSize.width() / (float)renderWidget->winSize.height();
        float midW = this->size().width();
        float midH = this->size().height();
        float ratio = midW / midH;
        if(ratio < oldRatio)
        {
            renderWidget->resize(midW,midW / oldRatio);
        }
        else
        {
            renderWidget->resize(midH * oldRatio,midH);
        }
        renderWidget->move((this->width() - renderWidget->width()) / 2.0f,
                           (this->height() - renderWidget->height()) / 2.0f);
    }

}
